class TwoDigits < Digits

  def self.run(num)
    new(num).in_words
  end
  
  def in_words
    less_than_20? ? less_than_20 : more_than_19 
  end
  
  private
  
  attr_reader :num
  
  def initialize(num)
    @num = num
  end
  
  def less_than_20?
    num < 20
  end
  
  def less_than_20 
    numbers_in_words['tenss'][num_mod(10)]
  end
  
  def more_than_19
    num_mod(10).zero? ? simple_tens : complex_tens
  end
  
  def simple_tens
    numbers_in_words['tens'][num/10]
  end
  
  def complex_tens
    [simple_tens, single_digits(num_mod(10))].join('-')
  end
  
end